import { http } from '@/utils/http'
import { ArticleCommentParams } from './type'
// 文章列表
export const fetchArticleList = <D>(p: Pagination & D) => http.get('/shopapi/article/lists', p)

// 文章详情
export const fetchArticleDetail = (id: string) => http.get('/shopapi/article/detail', { id })

// 添加文章评论
export const articleComment = (data: ArticleCommentParams) =>
  http.post('/shopapi/article_comment/add', data)

// 发布文章
export const addArticle = (data: ArticleCommentParams) => http.post('/shopapi/article/add', data)

// 文章分类
export const fetchArticleCate = (data: Pagination) =>
  http.get('/shopapi/article_category/lists', data)

// 评论列表
export const fetchCommentList = (
  data: Pagination & { article_id: string; article_comment_id?: string },
) => http.get('/shopapi/article_comment/lists', data)

//
export const articleCommentList = (data: Pagination & { type: number }) =>
  http.get('/shopapi/user/myJoin', data)
